import { defineConfig } from "@rsbuild/core";
import { pluginVue } from "@rsbuild/plugin-vue";
import { pluginLess } from "@rsbuild/plugin-less";
import AutoImport from "unplugin-auto-import/rspack";
import Components from "unplugin-vue-components/rspack";
import { VantResolver } from "@vant/auto-import-resolver";

export default defineConfig({
  html: {
    title: 'AI 推送',
    favicon: './aispire.svg',
  },
  output: {
    assetPrefix: './',
  },
  plugins: [pluginVue(), pluginLess()],
  tools: {
    postcss: {
      postcssOptions: {
        plugins: [
          {
            "postcss-pxtorem": {
              rootValue: 39.0,
              propList: ['*']
            }
          }
        ]
      },
    },
    rspack: {
      plugins: [
        // AutoImport({
        //   resolvers: [VantResolver()],
        // }),
        // Components({
        //   resolvers: [VantResolver()],
        // }),
      ],
    },
  },
  server: {
    host: '0.0.0.0',
    port: 3000,
    open: false,
    cors: true,
    proxy: {
      '/app-api': {
        target: 'https://www.aispire.info',
        changeOrigin: true
      },
      '/aispire': {
        target: 'https://www.aispire.info',
        changeOrigin: true
      },
    },
  },

});
